
#include "registers.h"
#include "stdio.h"
#include "delay.h"
#define CLOCK_50MHZ

int go_to_lcd(void);

int main(void)
{
	int i = 0;
	initio();
	printf("EE4720 Final");
	write_byte(0x00C0);
	delay10ms(1);
	printf("Matt Borneman");
	LEDR = 0x5555;
	while(1)
	{
		HEX0_3 = i++;
		LEDR = ~LEDR;
		delay10ms(25);
		if(SW & 0x0001)
		{
			go_to_lcd();
		}
	}

	return 0;
}

int go_to_lcd(void)
{

	while(SW & 0x0001)
	{
		if(!(KEY & 0x0001))
		{
			write_byte(0x0001);
			delay10ms(1);
			printf("How are you?");
		}
		if(!(KEY & 0x0002))
		{
			write_byte(0x0001);
			delay10ms(1);
			printf("What's up?");
		}
		if(!(KEY & 0x0004))
		{
			write_byte(0x0001);
			delay10ms(1);
			printf("Hi Dr. Li!");
		}
		if(!(KEY & 0x0008))
		{
			write_byte(0x0001);
			delay10ms(1);
			printf("Ok!");
		}
		delay10ms(25);
	}
	return 0;
}

#include "stdio.c"
#include "delay.c"